<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>登录</title>
    <jsp:include page="/WEB-INF/view/commons/css.jsp" />
    <style>
        .login-layout{
            background: url("static/images/lg_bg.jpg") no-repeat center top;
            background-size: 100% 100%;
        }
        .login-container{
            margin-top: 100px;
            width: 450px;
        }
        .widget-main h4{
            font-size: 26px;
            letter-spacing: 1.6px;
        }
        .subtitle{
            font-size: 14px;
            color: #48659c;
            letter-spacing: 1.5px;
            word-spacing: 2.3px;
        }
        .widget-main{
            padding: 40px;
        }
        .login-layout .login-box .widget-main{
            padding-bottom: 35px;
        }
        .input-icon>input{
            border-radius: 4px !important;
            border: 1px solid #a8a8a8;
            padding-left: 44px;
        }
        .input-icon>.ace-icon{
            color: #20a2ed;
            font-size: 26px;
            padding: 7px 10px;
        }
        .form-control{
            height: 46px;
        }
        .pointer{
            cursor: pointer;
            opacity: 0.8;
            font-size: 16px;
        }
    </style>
</head>
<body class="login-layout">
<p class="com-name">江苏慧世联网络科技有限公司</p>
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h1>
                            <span class="white" id="id-text2"><img src="static/images/qsign_logo.png" /></span>
                        </h1>
                    </div>

                    <div class="space-12"></div>

                    <div class="position-relative">
                        <div id="login-box" class="login-box">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="white center lighter">
                                        无纸化签约系统-激活管理平台
                                    </h4>
                                    <p class="center subtitle">PAPERLESS STOREHOUSE SYSTEM</p>
                                    <div class="space-14"></div>
                                    <form id="inputForm" action="login/checkUser" method="post">
                                        <fieldset>
                                            <label class="block clearfix">
														<span class="block input-icon">
															<input id="account" name="account" type="text" class="form-control" placeholder="请输入登录账号" />
															<i class="ace-icon fa fa-user"></i>
														</span>
                                            </label>

                                            <label class="block clearfix">
														<span class="block input-icon">
															<input id="password" name="password" type="password" class="form-control" placeholder="请输入登录密码" />
															<i class="ace-icon fa fa-lock"></i>
														</span>
                                            </label>
                                            <div class="space-12"></div>
                                            <div class="clearfix">
                                                <label class="inline">
                                                    <input id="readMe" type="checkbox" class="ace" />
                                                    <span class="lbl white"> 记住密码</span>
                                                </label>
                                                <div class="pull-right"><a class="white pointer">忘记密码？</a>&nbsp;<a class="white pointer">立即找回</a></div>
                                            </div>

                                            <div class="space-12"></div>
                                            <div class="">
                                                <button type="submit" class="btn btn-block btn-primary">
                                                    <span class="bigger-110">登录</span>
                                                </button>
                                            </div>

                                            <div class="space-4"></div>
                                        </fieldset>
                                    </form>

                                </div><!-- /.widget-main -->
                            </div><!-- /.widget-body -->
                        </div><!-- /.login-box -->


                    </div><!-- /.position-relative -->

                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.main-content -->
</div><!-- /.main-container -->


<!-- script start -->
<jsp:include page="/WEB-INF/view/commons/js.jsp" />
<script type="text/javascript" src="static/plugin/js/js.cookie.js"></script>
<script type="text/javascript">
    if (window != top) {
        top.location.href = location.href;
    }
    $(document).ready(function(e) {

        var options = {
            rules:{
                account:{required:true},
                password:{required:true}
            },
            submitHandler:function(form){
                saveReadMe();
                $(form).ajaxSubmit({
                    type:'post',
                    dataType:'json',
                    success:function(data){
                        if(data.success){
                            console.log("准备登录");
                            window.location.href="${ctx}/index/home";
                        }else{
                            layer.alert(data.msg);
                        }
                    }
                });
            }
        };
        $("#inputForm").validate(options);


        var account = $.cookie('account');
        var password = $.cookie('password');
        if (account && password) {
            $("#account").val(account);
            $("#password").val(password);
            $("#readMe").attr("checked", true);
        }

        function saveReadMe(){
            var readMe = $('#readMe')[0].checked;
            var account = readMe ? $('#account').val() : '';
            var password = readMe ? $('#password').val() :'';
            if(account && password){
                $.cookie('account', account,{ expires: 7});
                $.cookie('password', password,{ expires: 7});
            }
        }
    });
</script>
<!-- script end -->
</body>
</html>
